package com.focusai.efairy.ui.activity.project;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.KeyEvent;

import com.focusai.efairy.R;
import com.focusai.efairy.ui.base.SwipeBackBaseActivity;
import com.focusai.efairy.ui.fragment.ProjectFragment;

/**
 * Created by luo_guangwen on 2017/9/7.
 */

public class ProjectListActivity extends SwipeBackBaseActivity {
    public static final String PROJECT_ITEM = "project_item";
    private ProjectFragment fragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_dev_list);
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        Bundle bundle = new Bundle();
        bundle.putInt(ProjectFragment.OPEN_TYPE, getIntent().getIntExtra(ProjectFragment.OPEN_TYPE, ProjectFragment.OPEN_TYPE_PROJECT_MANAGE));
        fragment = new ProjectFragment();
        fragment.setArguments(bundle);
        transaction.add(R.id.flayout_contain, fragment);
        transaction.commit();
    }

    @Override
    protected boolean hasActionBar() {
        return false;
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (fragment.onKeyDown(keyCode, event)) {
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
